<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Converts a packed internet address to a human readable representation</title>
 </head>
 <body class="docs"><div id="layout">
  <div id="layout-content"><div id="function.inet-ntop" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">inet_ntop</h1>
  <p class="verinfo">(PHP 5 &gt;= 5.1.0, PHP 7)</p><p class="refpurpose"><span class="refname">inet_ntop</span> &mdash; <span class="dc-title">Converts a packed internet address to a human readable representation</span></p>

 </div>
 
 <div class="refsect1 description" id="refsect1-function.inet-ntop-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>inet_ntop</strong></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$in_addr</code></span>
   ) : <span class="type">string</span></div>

  <p class="simpara">
   This function converts a 32bit IPv4, or 128bit IPv6 address (if PHP
   was built with IPv6 support enabled) into an address family appropriate
   string representation.  
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.inet-ntop-parameters">
  <h3 class="title">参数</h3>
  <p class="para">
   <dl>

    
     <dt>
<code class="parameter">in_addr</code></dt>

     <dd>

      <p class="para">
       A 32bit IPv4, or 128bit IPv6 address.
      </p>
     </dd>

    
   </dl>

  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.inet-ntop-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   Returns a string representation of the address 或者在失败时返回 <strong><code>FALSE</code></strong>.
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-function.inet-ntop-examples">
  <h3 class="title">范例</h3>
  <p class="para">
   <div class="example" id="example-5499">
    <p><strong>Example #1 <span class="function"><strong>inet_ntop()</strong></span> Example</strong></p>
    <div class="example-contents">
<div class="phpcode"><pre><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br />$packed&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">chr</span><span style="color: #007700">(</span><span style="color: #0000BB">127</span><span style="color: #007700">)&nbsp;.&nbsp;</span><span style="color: #0000BB">chr</span><span style="color: #007700">(</span><span style="color: #0000BB">0</span><span style="color: #007700">)&nbsp;.&nbsp;</span><span style="color: #0000BB">chr</span><span style="color: #007700">(</span><span style="color: #0000BB">0</span><span style="color: #007700">)&nbsp;.&nbsp;</span><span style="color: #0000BB">chr</span><span style="color: #007700">(</span><span style="color: #0000BB">1</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$expanded&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">inet_ntop</span><span style="color: #007700">(</span><span style="color: #0000BB">$packed</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">/*&nbsp;Outputs:&nbsp;127.0.0.1&nbsp;*/<br /></span><span style="color: #007700">echo&nbsp;</span><span style="color: #0000BB">$expanded</span><span style="color: #007700">;<br /><br /></span><span style="color: #0000BB">$packed&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">str_repeat</span><span style="color: #007700">(</span><span style="color: #0000BB">chr</span><span style="color: #007700">(</span><span style="color: #0000BB">0</span><span style="color: #007700">),&nbsp;</span><span style="color: #0000BB">15</span><span style="color: #007700">)&nbsp;.&nbsp;</span><span style="color: #0000BB">chr</span><span style="color: #007700">(</span><span style="color: #0000BB">1</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$expanded&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">inet_ntop</span><span style="color: #007700">(</span><span style="color: #0000BB">$packed</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">/*&nbsp;Outputs:&nbsp;::1&nbsp;*/<br /></span><span style="color: #007700">echo&nbsp;</span><span style="color: #0000BB">$expanded</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</pre></div>
    </div>

   </div>
  </p>
 </div>


 <div class="refsect1 changelog" id="refsect1-function.inet-ntop-changelog">
  <h3 class="title">更新日志</h3>
  <p class="para">
   <table class="doctable informaltable">
    
     <thead>
      <tr>
       <th>版本</th>
       <th>说明</th>
      </tr>

     </thead>

     <tbody class="tbody">
      <tr>
       <td>5.3.0</td>
       <td>
         This function is now available on Windows platforms.
       </td>
      </tr>

     </tbody>
    
   </table>

  </p>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.inet-ntop-seealso">
  <h3 class="title">参见</h3>
  <p class="para">
   <ul class="simplelist">
    <li class="member"><span class="function"><a href="long2ip.html" class="function" rel="rdfs-seeAlso">long2ip()</a> - 将长整型转化为字符串形式带点的互联网标准格式地址（IPV4）</span></li>
    <li class="member"><span class="function"><a href="ip2long.html" class="function" rel="rdfs-seeAlso">ip2long()</a> - 将 IPV4 的字符串互联网协议转换成长整型数字</span></li>
    <li class="member"><span class="function"><a href="inet_pton.html" class="function" rel="rdfs-seeAlso">inet_pton()</a> - Converts a human readable IP address to its packed in_addr representation</span></li>
   </ul>
  </p>
 </div>


</div></div></div></body></html>